x11: Avoid crash in fallback move emulation
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Dec 2017 21:17:27 +0000 (16:17 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Dec 2017 21:17:27 +0000 (16:17 -0500)
Quietly do nothing when there is already an ongoing operation.
This matches the behavior of the ewmh code, and is much nicer
than a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=789054

gdk/x11/gdkwindow-x11.c

index 3d6fd3bf6c4ae445359fe3e9e4f6de64d042a41e..70daed9b6d54b99ad86b537cd18ba729303a8fcf 100644 (file)
@@ -5281,6 +5281,9 @@ emulate_resize_drag (GdkWindow     *window,
 {
   MoveResizeData *mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE);
 
+  if (mv_resize->moveresize_window != NULL)
+    return; /* already a drag operation in progress */
+
   mv_resize->is_resize = TRUE;
   mv_resize->moveresize_button = button;
   mv_resize->resize_edge = edge;
@@ -5311,7 +5314,10 @@ emulate_move_drag (GdkWindow     *window,
                    guint32        timestamp)
 {
   MoveResizeData *mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE);
-  
+
+  if (mv_resize->moveresize_window != NULL)
+    return; /* already a drag operation in progress */
+
   mv_resize->is_resize = FALSE;
   mv_resize->device = device;
   mv_resize->moveresize_button = button;